import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:lottie/lottie.dart';
import 'package:meiyunapp/generated/assets.dart';

class NotFindPage extends StatefulWidget {
  const NotFindPage({Key? key}) : super(key: key);

  @override
  State<NotFindPage> createState() => _NotFindPageState();
}

class _NotFindPageState extends State<NotFindPage>
    with TickerProviderStateMixin {
  late final AnimationController _animationController;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(vsync: this,duration: const Duration(seconds: (1)),);
    _animationController.addStatusListener((status) {
      if(status==AnimationStatus.completed){
        _animationController.reset();
        _animationController.forward();
      }
    });
  }

  @override
  void dispose() {
    _animationController.reset();
    _animationController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("404"),
      ),
      body: Container(
        margin: EdgeInsets.only(top: 30.h),
        child: Lottie.asset(
          Assets.lottieAstronaout,
          controller: _animationController,
            repeat: true,
          onLoaded: (comp) {
            _animationController
              ..duration = comp.duration
              ..forward();
          },
        ),
      ),
    );
  }
}
